/* generates a user-ID for a student using his initials and student ID */

import java.util.Scanner;
public class MakeUserID {
   public static void main(String[] args) {
      Scanner scanner = new Scanner(System.in);
      System.out.println("Enter a three word name");
      String name = scanner.nextLine();
      System.out.println("Enter the ID");
      int id = scanner.nextInt();
      int index1 = name.indexOf(' ');
      int index2 = name.lastIndexOf(' ');
      
      //extract initials
      String initials = "" +  name.charAt(0)+
           name.charAt(index1 + 1) + name.charAt(index2 + 1);
      
      //append id
      String userID = initials.toLowerCase()+id;
      System.out.println("Your UserID = " + userID);
   }
}

